home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / blrmu13.zip / GO.ASM < prev    next >
Assembly Source File  |  1991-07-07  |  4KB  |  154 lines

  1. page ,132
  2. title go ( chg to drv and dir ) as of 07/07/91 - 12:35 pm
  3. ;*-------------------------------------------------
  4. ;
  5. ;        Go ( chg to drv or drv and dir )
  6. ;
  7. ;        syntax :
  8. ;                 go x
  9. ;                 go x ddddddddd
  10. ;
  11. ;        where x = new drv, and d = directory name
  12. ;
  13. ;*-------------------------------------------------
  14. ;
  15.          include iomac.lib
  16. ;
  17. ;*--------------------------------------
  18. code     segment para public 'code'
  19. ;*--------------------------------------
  20. ;
  21.          assume  cs:code,ds:code,es:code
  22. ;
  23. ;*----------------
  24. ;*  cmd line map
  25. ;*----------------
  26.          org   128
  27. ;*----------------
  28. ;
  29. pl       db    0             ; parm len ( includes space )
  30.          db    0             ; space
  31. drv      db    0             ; x
  32.          db    0             ; space
  33. dir      db    50 dup (0)    ; directory name
  34. ;
  35. ;*------------------------------------
  36. ;*  start of program memory location
  37. ;*------------------------------------
  38.          org   256
  39. ;*-------------------
  40. ;*  pgm starts here
  41. ;*-------------------
  42. ;
  43. go:
  44.          jmp   pcl           ; jump around data
  45. ;
  46. ;*-----------------------
  47. ;*  data is stored here
  48. ;*-----------------------
  49. ;
  50. cdem     db    13,10,10
  51.          db    ' * change directory error ! '
  52.          db    13,10,10
  53. cdeml    equ   $-cdem
  54. ;
  55. dpem     db    ' * drv / path = '
  56. dpev     db    53 dup (0)
  57. dpeml    equ   $-dpem
  58. ;
  59. cll      db    13,10,10      ; cr, lf, lf
  60. ;
  61. spl      db    0             ; save parm len
  62. ;
  63. dirpath  label byte          ; directory path
  64. dpd      db    0             ; dir path drv
  65.          db    ':\'
  66. dpn      db    50 dup (0)    ; dir path name
  67. ;
  68. ;*--------------------------
  69. ;*  process command line
  70. ;*--------------------------
  71. ;
  72. pcl:
  73.          cmp   pl,0          ; parm len = 0 ?
  74.          je    exit          ; if so, exit
  75.          mov   al,pl         ; save
  76.          mov   spl,al        ; parm len
  77. ;
  78. ;*-----------------------
  79. ;*  get drive letter
  80. ;*-----------------------
  81. ;
  82.          mov   al,drv        ; move drv ltr
  83.          mov   dpd,al        ; to dir path
  84.          call  stnd          ; set the new drv
  85. ;
  86. ;*---------------------------
  87. ;*  get the name for ch dir
  88. ;*---------------------------
  89. ;
  90.          lea   si,dir        ; ptr to sors
  91.          lea   di,dpn        ; ptr to dest
  92.          mov   cl,spl        ; get len
  93.          sub   ch,ch         ; clear hi byte
  94.          cld                 ; set direction flag to forward
  95.          rep   movsb         ; move sors to dest
  96. ;
  97. ;*---------------------------------
  98. ;*  get the name for err display
  99. ;*---------------------------------
  100. ;
  101.          lea   si,dpd        ; ptr to sors
  102.          lea   di,dpev       ; ptr to dest
  103.          mov   cl,spl        ; get len
  104.          sub   ch,ch         ; clear hi byte
  105.          cld                 ; set direction flag to forward
  106.          rep   movsb         ; move sors to dest
  107. ;
  108. ;*-------------------
  109. ;*  do the ch dir
  110. ;*-------------------
  111. ;
  112.          ccd   dirpath       ; change directory
  113.          jnc   exit          ; if no err, exit
  114. ;
  115. ;*--------------------------
  116. ;*  display error messages
  117. ;*--------------------------
  118. ;
  119.          waf   1,cdem,cdeml  ; ch dir err msg
  120.          waf   1,dpem,dpeml  ; drv / path err msg
  121.          waf   1,cll,3       ; cr, lf, lf
  122. ;
  123.          mov   al,1          ; set ret code to 1
  124.          mov   ah,76         ; term with ret code
  125.          int   33
  126. ;
  127. exit:
  128. ;
  129.          waf   1,cll,3       ; cr, lf, lf
  130. ;
  131.          mov   al,0          ; set ret code = 0
  132.          mov   ah,76         ; term with ret code
  133.          int   33
  134. ;
  135. ;*--------------------------
  136. ;*   set the new drv
  137. ;*--------------------------
  138. ;
  139. stnd     proc  near
  140.          mov   dl,al         ; get drv ltr
  141.          sub   dl,65         ; adjust it
  142.          cmp   dl,4          ; hi limit ?
  143.          jbe   doit          ; if LT/EQ, ok, was upper case
  144.          sub   dl,32         ; adjust it again, was lower case letter
  145. doit:
  146.          mov   ah,14         ; select
  147.          int   33            ; disk
  148.          ret                 ; return
  149. stnd     endp
  150. ;
  151. code     ends
  152. ;
  153.          end   go
  154.